//test case
load("global.js");
load("global_data.js");
load("shape.js");
load("blue_lib.js");
load("statistics.js");
G_DEBUG=false;
test_coll=[];
test_coll.push(getTermData(LAST_TERM,0));
test_coll.push(getPreTermData(LAST_TERM));
print("Test term function.....Last Term:"+LAST_TERM);
print(getTerm(LAST_TERM,0))
print(getTerm(LAST_TERM,-1))
print(getTerm(LAST_TERM,-2))
print(getTerm(LAST_TERM,-14))
print(getTerm(LAST_TERM,+1))
print("get term index.......");
print(getTermIndex(LAST_TERM,0));
print(getTermIndex(LAST_TERM,1));
print(getTermIndex(LAST_TERM,-3));
print(getTermIndex(LAST_TERM,-11));
print("statistics.......");
test1= new G_OBJECT();
print("statistics.......assign");
test1.RECORDS_COLLECT = G_BALLS;

print("statistics.......begin...");
test1= new G_OBJECT();
stat(test1);
printStat(test1);
print("hasNumber.......begin...10");
print(hasNumber(getTermData(LAST_TERM,0),07));
print(hasNumber(getTermData(LAST_TERM,0),10));
print("hasGroupNumber.......begin...10");
print(hasGroupNumber(getTermData('2013030',0),['07','14']));//return true;
print(hasGroupNumber(getTermData('2013030',0),['06','14']));//return false;
print("findAllTerm.......begin...100,25,26");
a=hasAllGroupTerm(G_BALLS.slice(G_BALLS.length-400,G_BALLS.length),['25','26']);//recently 
print("find record:"+a.length);
print("print record:"+a);

print("hasAllGroupNextTerm.......begin...100,25,26");
b=hasAllGroupNextTerm(G_BALLS.slice(G_BALLS.length-400,G_BALLS.length),['25','26']);//recently 
print("find record:"+a.length);
print("print record:"+b);
print("getHorizontalDistance......"+LAST_TERM);
print(getHorizontalDistance(LAST_TERM));
print("getVerticalDistance......fake num");
print(getVerticalDistance('2013032',51));

print("hasNumber......yes?");
G_DEBUG=true;
print(hasNumber(getTermData('2013032',0),04));
print(hasNumber(getTermData('2013032',0),05));
G_DEBUG=false;

print("getVerticalDistance......fake num");
print(getVerticalDistance('2013032',5));
print("getVerticalDistance......real num");
print(getVerticalDistance('2013032',4));

print("getMatchTermData......real num,recently 100");
var index=getTermIndex('2013034',0)
var gmt1=getMatchTermData(1,1,100,index);
print("match..."+gmt1[0].length);
print("Next..."+gmt1[1].length);
//for(var i=0;i<gmt1[0].length;i++) { 	print(gmt1[0][i]); }
//for(var i=0;i<gmt1[1].length;i++) { 	print(gmt1[1][i]);}
print("findHistoryFriendNumber......red ball 1 recently 10");
var fhf1=findHistoryFriendNumber(1,1,9,index);
print("Red ball...");
printArray(fhf1[0]);
print("blue ball...");
printArray(fhf1[1]);

print("findForcastFriendNumber......red ball 1 recently 10");
var fhf2=findForcastFriendNumber(1,1,100,index);
print("Red ball...");
printArray(fhf2[0]);
print("blue ball...");
printArray(fhf2[1]);
print("findSumForCastProbability......"+LAST_TERM);
var fsfcp=findSumForCastProbability(LAST_TERM);
print("getMax......");
G_DEBUG=true;
getMaxMinFre(fsfcp[0]);
print("getSectionFre......");
G_DEBUG=false;
var gsf=getSectionFre(fsfcp[0]);
G_DEBUG=false;
for(var g=0;g<gsf.length;g++){print(gsf[g].name);print("Max Ball:"+(parseInt(gsf[g].begin,10)+parseInt(gsf[g].result[MAX_RB],10)));print("Max Fre:"+gsf[g].result[MAX_FRE]);print("Min Ball:"); gsf[g].result[MIN_RB].forEach(function(entry){print((parseInt(entry,10)+parseInt(gsf[g].begin,10)));});print("Min Fre:"+gsf[g].result[MIN_FRE]);}
G_DEBUG=false;


